summary(fit.2a.app)
logLik(fit.2a.app)
data2$int3_app <- data2$ideoshirk_app * data2$majority
fit.2b.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
int3_app, data=data2, family=binomial(link="logit"))
summary(fit.2b.app)
logLik(fit.2b.app)
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
par(mar=c(5,4,4,2), mfrow=c(1,1))
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
logLik(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
logLik(fit.2a.comp)
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
par(mar=c(5,4,4,2), mfrow=c(1,1))
rm(list=ls())
data2 <- read.csv("data2.csv", header=T, stringsAsFactors=F)
data2$ideoshirk_leaving <- as.numeric(data2$leaving) * data2$ideo_d1
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
fit.2 <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2)
fit.3 <- glm(leg2_yeav ~ notnom_depart + notapp_depart + ideo_d1 +
ideoshirk_notapp + ideoshirk_notnom + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.3)
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
rm(list=ls())
dat <- read.csv("data.csv",header=T,stringsAsFactors=F)
library(pscl)
model.4 <- hurdle(rtotal_leg_p ~ depart + seniority + motion + age + type | depart + seniority + motion + age + type, data=dat, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.4)
rm(list=ls())
setwd("~/Dropbox/2019_05/JJPS_rep")
dat <- read.csv("data.csv",header=T,stringsAsFactors=F)
library(pscl)
model.4 <- hurdle(rtotal_leg_p ~ depart + seniority + motion + age + type | depart + seniority + motion + age + type, data=dat, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.4)
dat$nideoshirk <- dat$depart*dat$ideo_d1
model.5 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + seniority + motion + age + type, data=dat, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.5)
model.6 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk| depart + seniority + motion + age + type, data=dat, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.6)
model.4.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type | depart + motion + seniority + age + type, data=dat, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.4.a)
model.5.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age + type, data=dat, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.5.a)
model.6.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk |depart + motion + seniority + age + type, data=dat, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.6.a)
data2 <- read.csv("data2.csv", header=T, stringsAsFactors=F)
data2$ideoshirk_leaving <- as.numeric(data2$leaving) * data2$ideo_d1
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
fit.2 <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2)
fit.3 <- glm(leg2_yeav ~ notnom_depart + notapp_depart + ideo_d1 +
ideoshirk_notapp + ideoshirk_notnom + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.3)
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
source("interaction_plots_rr.R")
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
rm(list=ls())
dat17 <- read.csv("lame_duck_17.csv", header=T)
str(dat17)
colnames(dat17)
library(pscl)
rm(list=ls())
setwd("~/Dropbox/2019_05/JJPS_rep")
dat17 <- read.csv("lame_duck_17.csv", header=T)
dat18 <- read.csv("data.csv",header=T,stringsAsFactors=F)
library(pscl)
model.4 <- hurdle(rtotal_leg_p ~ depart + seniority + motion + age + type | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.4)
dat$nideoshirk <- dat$depart*dat$ideo_d1
model.5 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.5)
model.6 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk| depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.6)
model.4.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type | depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.4.a)
rm(list=ls())
dat <- read.csv("lame_duck_17.csv", header=T)
str(dat)
colnames(dat)
return <- as.numeric(dat$X_18th)
dat$return <- return
depart <- 1 - return
dat$depart <- depart
t.dat <- dat[!is.na(dat$depart),]
length(t.dat$depart)
res.NB.4 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type | depart + motion + seniority + age1 + type, data=t.dat, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(res.NB.4)
write.csv(t.dat, "dat17.csv", row.names=F)
rm(list=ls())
setwd("~/Dropbox/2019_05/JJPS_rep")
dat17 <- read.csv("dat17.csv", header=T)
dat18 <- read.csv("data.csv",header=T,stringsAsFactors=F)
library(pscl)
model.1 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.1)
model.2 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion +  seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.2)
dat17$nideoshirk <- dat17$depart*dat17$ideo_d1
model.2 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion +  seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.2)
write.csv(dat17, "dat17.csv", row.names=F)
rm(list=ls())
setwd("~/Dropbox/2019_05/JJPS_rep")
dat17 <- read.csv("dat17.csv", header=T)
dat18 <- read.csv("data.csv",header=T,stringsAsFactors=F)
library(pscl)
model.1 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.1)
model.2 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion +  seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.2)
model.3 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.3)
model.1.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type |depart + motion + seniority + age1 + type, data=t.dat, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.1.a)
model.1.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type |depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.1.a)
model.2.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.2.a)
model.3.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.3.a)
data2 <- read.csv("data2.csv", header=T, stringsAsFactors=F)
data2$ideoshirk_leaving <- as.numeric(data2$leaving) * data2$ideo_d1
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
fit.2 <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2)
fit.3 <- glm(leg2_yeav ~ notnom_depart + notapp_depart + ideo_d1 +
ideoshirk_notapp + ideoshirk_notnom + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.3)
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
source("interaction_plots_rr.R")
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
leg.27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + ideo_d1:leaving +
X_dum2 + dj_chnam, data = data1,
family=binomial(link="logit"))
summary(leg.27)
leg.27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + ideo_d1:leaving +
X_dum2 + dj_chnam, data = dat17,
family=binomial(link="logit"))
summary(leg.27)
rm(list=ls())
load("~/Dropbox/2019_05/JJPS_rep/20160804_logit.RData")
summary(fit.3a)
summary(fit.3b)
summary(fit.3c)
str(data1)
dat.n <- data.frame(data1$leg27_yeav, data1$leaving, data1$seniority,
data1$ideo_d1, data1$dj_chnam,
data1$leg28_yeav)
str(dat.n)
colnames(dat.n) <- c("leg27_yeav","leaving","seniority","ideo_d1","dj_chnam",
"leg28_yeav")
write.csv(dat.n, "data1.csv", row.names=F)
rm(list=ls())
data1 <- read.csv("data.csv",header=T)
leg27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg27)
data1 <- read.csv("data1.csv",header=T)
leg27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg27)
leg28 <- glm(leg28_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg28)
rm(list=ls())
dat17 <- read.csv("dat17.csv", header=T)
dat18 <- read.csv("data.csv",header=T,stringsAsFactors=F)
data1 <- read.csv("data1.csv",header=T)
library(pscl)
model.1 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.1)
dat17$nideoshirk <- dat17$depart*dat17$ideo_d1
model.2 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion +  seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.2)
model.3 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.3)
model.4 <- hurdle(rtotal_leg_p ~ depart + seniority + motion + age + type | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.4)
dat$nideoshirk <- dat$depart*dat$ideo_d1
model.5 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
model.5 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.5)
model.6 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk| depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.6)
model.1.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type |depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.1.a)
model.2.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.2.a)
model.3.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.3.a)
model.4.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type | depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.4.a)
model.5.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.5.a)
# model 6: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.6.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk |depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.6.a)
leg27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg27)
leg28 <- glm(leg28_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg28)
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
data2 <- read.csv("data2.csv", header=T, stringsAsFactors=F)
data2$ideoshirk_leaving <- as.numeric(data2$leaving) * data2$ideo_d1
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
fit.2 <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2)
fit.3 <- glm(leg2_yeav ~ notnom_depart + notapp_depart + ideo_d1 +
ideoshirk_notapp + ideoshirk_notnom + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.3)
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
source("interaction_plots_rr.R")
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
rm(list=ls())
# setwd("~/Dropbox/2019_05/JJPS_rep")
dat17 <- read.csv("dat17.csv", header=T)
dat18 <- read.csv("data.csv",header=T,stringsAsFactors=F)
data1 <- read.csv("data1.csv",header=T)
data2 <- read.csv("data2.csv", header=T, stringsAsFactors=F)
library(pscl)
model.1 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.1)
# model 2: binomial with logit link (zero hurdle model) and
#     truncated negative binomial model with logit link (count model)
dat17$nideoshirk <- dat17$depart*dat17$ideo_d1
model.2 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion +  seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.2)
# model 3: binomial with logit link (zero hurdle model) and
#     truncated negative binomial model with logit link (count model)
model.3 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.3)
# model 4: binomial with logit link (zero hurdle model) and
#     truncated negative binomial model with logit link (count model)
model.4 <- hurdle(rtotal_leg_p ~ depart + seniority + motion + age + type | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.4)
# model 5: binomial with logit link (zero hurdle model) and
#     truncated negative binomial model with logit link (count model)
model.5 <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.5)
# model 6: binomial with logit link (zero hurdle model) and
#     truncated negative binomial model with logit link (count model)
model.6 <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk| depart + seniority + motion + age + type, data=dat18, dist = "negbin", zero.dist = "binomial", link = "logit")
summary(model.6)
# model 1: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.1.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type |depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.1.a)
# model 2: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.2.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.2.a)
# model 3: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.3.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age1 + type + ideo_d1 + nideoshirk | depart + motion + seniority + age1 + type, data=dat17, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.3.a)
# model 4: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.4.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type | depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.4.a)
# model 5: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.5.a <- hurdle(rtotal_leg_p ~ depart + ideo_d1 + nideoshirk | depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.5.a)
# model 6: binomial with logit link (zero hurdle model) and
#     poisson model with logit link (count model)
model.6.a <- hurdle(rtotal_leg_p ~ depart + motion + seniority + age + type + ideo_d1 + nideoshirk |depart + motion + seniority + age + type, data=dat18, dist="poisson", zero.dist = "binomial", link = "logit")
summary(model.6.a)
################################################################################
# TABLE 4
################################################################################
# Legislation 27 (DGIST)
################################################################################
leg27 <- glm(leg27_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg27)
################################################################################
# Legislation 28 (GIST)
################################################################################
leg28 <- glm(leg28_yeav ~ leaving + seniority + ideo_d1 + dj_chnam + dj_chnam:leaving,
data = data1, family=binomial(link="logit"))
summary(leg28)
data2$ideoshirk_leaving <- as.numeric(data2$leaving) * data2$ideo_d1
fit.1 <- glm(leg2_yeav ~ leaving + ideo_d1 + ideoshirk_leaving + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.1)
fit.2 <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2)
fit.3 <- glm(leg2_yeav ~ notnom_depart + notapp_depart + ideo_d1 +
ideoshirk_notapp + ideoshirk_notnom + seniority +
majority, data=data2, family=binomial(link="logit"))
summary(fit.3)
data2$app_depart <- factor(data2$app_depart)
data2$ideoshirk_app <- as.numeric(data2$app_depart) * data2$ideo_d1
fit.2a.app <- glm(leg2_yeav ~ app_depart + seniority + ideo_d1 + majority +
ideoshirk_app,
data=data2, family=binomial(link="logit"))
summary(fit.2a.app)
data2$comp_depart <- factor(data2$comp_depart)
data2$ideoshirk_comp <- as.numeric(data2$comp_depart) * data2$ideo_d1
fit.2a.comp <- glm(leg2_yeav ~ comp_depart + seniority + ideo_d1 + majority +
ideoshirk_comp,
data=data2, family=binomial(link="logit"))
summary(fit.2a.comp)
############################################################################
# Figure 3
############################################################################
source("interaction_plots_rr.R")
par(mar=c(5,6,4,4), oma=c(0,0,4,0), mfrow=c(1,2))
interaction_plot_continuous(model=fit.2a.app, effect = "app_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_app",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Defeated Candidate")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
interaction_plot_continuous(model=fit.2a.comp, effect = "comp_depart1",
moderator = "ideo_d1",
interaction = "ideoshirk_comp",
median = TRUE,
breaks=20,
num_points = 100,
xlabel = "Ideological Distance from the Floor",
ylabel = "Marginal effect of Lame Duck Status \n on Yea Vote",
title = "Retiree")
# mtext("National Assembly Rule Amendment", outer = TRUE, cex = 1.5)
setwd("C:/Users/bkoo/Dropbox/2019_05/JJPS_rep")
# setwd("~/Dropbox/2019_05/JJPS_rep")
dat17 <- read.csv("dat17.csv", header=T)
